
<?php 
	include_once("web_header.php");
?>
<script type="text/javascript"  src="/include/ajaxfileupload.js"></script>

 
<div class="web_wrap">
    <div class="reg_content_wrap">
         <div  style="width:25%;float:left;">
        <?php 
          include_once("web_coach_dashmenu.php");
        ?>
         </div>
         <div class="dash_rightdiv">
                   <div class="subhead"> 
               <span class="glyphicon glyphicon-calendar"></span>  编辑日程信息
           </div>

 
<div id="regbox">
    <div  class="coachbox sec2" style=" ">
	 <table class="caltable">
         <tr class="scol" >
             <td style="font-weight:bold">时间</td>
             <td style="font-weight:bold">上午</td>
             <td style="font-weight:bold">下午</td>
             <td style="font-weight:bold">晚上</td>
          </tr>
         <tr >
             <td>周一</td>
             <td>
                <span class="checkspan" id="cs1"><img src="/images/checkbg.png"> </span> 
             </td>
             <td>
                <span class="checkspan" id="cs2"><img src="/images/checkbg.png"> </span> 
             </td>
             <td>
             <span class="checkspan" id="cs3"><img src="/images/checkbg.png"> </span> 
             </td>
          </tr>
         <tr class="scol">
             <td>周二</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>
         <tr >
             <td>周三</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>
         <tr class="scol">
             <td>周四</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>
         <tr >
             <td>周五</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>
         <tr class="scol">
             <td>周六</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>
         <tr  >
             <td>周日</td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
             <td><span class="checkspan"><img src="/images/checkbg.png"> </span> </td>
          </tr>

	 </table>

   <div class="form-group" style="margin-top:20px;">
      <label for="name">附加说明</label>
      <input type="text" class="form-control" id="caldesc" value="<?=$coach->caldesc?>" placeholder="如果有请填写">
   </div>


	 <div style="padding:10px; color:#dddddd; text-align:center">
	         	  <button id="submitButton" type="" class="btn btn-primary">
				     <div id="submitButtonText">设置</div>
				  </button>

	 </div>
</div>
    
</div>
	    
 


         </div>
                  <div style="clear:both"></div>

     </div>
</div>



 
 
<script type="text/javascript">

   var userid = '';
   var phonenumber = '';
   var wx_openid = '';
   var currentimg = null;

   var calvar = '<?=$coach->calval?>';



  $(".checkspan").on('click',function(){
         var imgsrc = $(this).children("img").attr("src");
          if(imgsrc == '/images/checkbg.png'){
            $(this).children("img").attr("src","/images/checked.png");
         }else{
            $(this).children("img").attr("src","/images/checkbg.png");
         }
  });

  var strs = new Array(); //定义一数组 
  strs = calvar.split("|",21); //字符分割 

  $(".checkspan").each(function(index,el){
        var cval = strs[index];
        if(cval=='1'){
            $(this).children("img").attr("src","/images/checked.png");
        }else{
            $(this).children("img").attr("src","/images/checkbg.png");
        }


         // var imgsrc = $(this).children("img").attr("src");
         //       if(imgsrc == '/images/checked.png'){
         //           checkval = checkval + '1|';
         //       }else{
         //           checkval = checkval + '0|';
         //       }
  });

  
  $("#idcard").on('click',function(){
         $("#userthumbfile").click();
         currentimg = 'idcard';
   });
   $("#cert1").on('click',function(){
         $("#userthumbfile").click();
         currentimg = 'cert1';
   });


   $(".addcert").on('click',function(){
       var certid = $(this).attr("certid");
       if(certid='1'){
             $("#cert2div").show();
       }  
       if(certid='2'){
             $("#cert3div").show();
       }  
   });


  
    var checkval = '';
    $("#submitButton").on('click',function(){
    	   //sendInfo_1();
          checkval = '';
          $(".checkspan").each(function(){
               var imgsrc = $(this).children("img").attr("src");
               if(imgsrc == '/images/checked.png'){
                   checkval = checkval + '1|';
               }else{
                   checkval = checkval + '0|';
               }
          });
          sendInfo_1(); 
    });

    function showlayer(showword){
			layer.open({
			    content:showword,
			    style: 'background-color:#09C1FF; color:#fff; border:none;',
			    time: 2
			});
    }

    function sendInfo_1(){
      
      var caldesc = $("#caldesc").val();
 
 	    layer.open({
  		    content: '正在注册',
  		    className: 'bluelayer'
  		});

        $.ajax({
            url: '/index.php/coach/web_dashboard_cal_handle',
            type: 'POST',
            data:{checkval:checkval,caldesc:caldesc},
            dataType: 'json',
            error: function(){
                  alert('Error loading PHP document'); 
                  posting = false;
             },
            success: function(result){
 
         				if(result.result==7){   
                      layer.open({
                						    content: '请重新登录',
                						    className: 'bluelayer',
                						    time: 233
                					  });
                      return;
                 }

                if(result.result==1){
                      layer.open({
            						    content: '修改完成',
            						    className: 'bluelayer',
            						    time: 2
            						});
                      return;
                }else{
                      layer.open({
          						    content: '请填写完整',
          						    className: 'bluelayer',
          						    time: 2
          						});
                      return;
                }
                posting = false;
            }
        });

    }

 
 
</script>




<?php 
	include_once("web_footer.php");
?>
